# coding:utf-8
import time

from lib.base import Base

from page.android import train_append_passenger_page, train_user_center_page, train_account_page

__author__ = 'weixin.yuan'


class TrainAppendPassenger(Base):
    """添加乘客"""
    def __init__(self, method_name):
        Base.__init__(self, method_name)

        """
        本页元素
        """
        self.name = train_append_passenger_page.elements['姓名']
        self.id_card = train_append_passenger_page.elements['身份证']
        self.yes = train_append_passenger_page.elements['确定']
        self.Tips = train_append_passenger_page.elements['小驼温馨提示']
        self.success = train_append_passenger_page.elements['添加成功']
        self.finish = train_append_passenger_page.elements['完成']
        """
        外部页面元素
        """
        self.account_btn = train_user_center_page.elements['常用乘客']
        self.add_btn = train_account_page.elements['添加新乘客']

    def test_append_passenger(self):
        """添加乘客"""
        self.open_schema_android('6018')
        self.click(self.name)
        self.click(self.name)
        self.send_keys_by_adb(u'袁维鑫')
        self.click(self.id_card)
        self.send_keys_by_adb('230221199009294217')
        time.sleep(5)
        self.click(self.finish)
        self.check(self.Tips)




